<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增软件')"/>
    <th:block th:include="include :: datetimepicker-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-software-add">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">软件名称：</label>
            <div class="col-sm-8">
                <input name="softwareName" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">授权日：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="grantDate" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">完成人：</label>
            <div class="col-sm-8">
                <textarea name="mainCompletedMan" class="form-control" required></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">著作权人：</label>
            <div class="col-sm-8">
                <input name="copyrightOwner" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">著作权登记号：</label>
            <div class="col-sm-8">
                <input name="copyrightNo" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">我院排序：</label>
            <div class="col-sm-8">
                <input name="ownSort" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">申报单位：</label>
            <div class="col-sm-8">
                <select name="reportUnitId" id="reportUnitId" class="form-control m-b"
                        th:with="type=${@dept.getUnit()}">
                    <option value="">-选择部门-</option>
                    <option th:each="dict : ${type}" th:text="${dict.deptName}" th:value="${dict.deptId}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">科室：</label>
            <div class="col-sm-8">
                <div class="input-group">
                    <select name="departmentId" id="departmentId" class="form-control m-b">
                        <option value="">-选择科室-</option>
                    </select>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">申报时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="reportTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">是否属于创新激励奖：</label>
            <div class="col-sm-8">
                <select name="pressLevel" class="form-control m-b" th:with="type=${@dict.getType('is_innovate')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">协议类型：</label>
            <div class="col-sm-8">
                <select name="protocolType" class="form-control m-b" th:with="type=${@dict.getType('protocol_type')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script type="text/javascript">
    var prefix = ctx + "system/software"
    $("#form-software-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-software-add').serialize());
        }
    }

    $("input[name='grantDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='reportTime']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='gmtTime']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
    $("#reportUnitId").change(function () {
        var t = $("#reportUnitId").val();
        if (t == '') {
            return;
        }

        $.ajax({
            url: ctx + 'system/dept/getDept',
            async: false,
            type: 'get',
            data: {unit: t},
            success: function (data) {
                var t3 = $("#departmentId").empty();
                for (var i = 0; i < data.length; i++) {
                    t3.append("<option value='" + data[i].deptId + "'>" + data[i].deptName + "</option>");
                }
            }
        })
    });
</script>
</body>
</html>